package com.zzh.bc.modules.jks.service.impl;

import com.zzh.bc.log.log;
import com.zzh.bc.model.JksModel;
import com.zzh.bc.model.PageModel;
import com.zzh.bc.modules.jks.dao.JksDao;
import com.zzh.bc.modules.jks.service.JksService;

import java.util.List;

/**
 *
 */
public class JksServiceImpl implements JksService {

    JksDao jksDao;

    private void checkDao() {
        if (jksDao == null) {
            jksDao = new JksDao();
        }
    }


    @Override
    public JksModel findById(String id) {
        checkDao();
        return jksDao.findObjById(id);
    }

    @Override
    public List<JksModel> findAll(int page) {
        checkDao();
        PageModel model = new PageModel();
        model.setOffset(page);
        model.setPageSize(10);
        log.d("findAll 数据 page start: " + model.getOffset());
        return jksDao.findAllObjByPage(model);
    }
}
